<template>
<div class="header">
	<div class="box">
<el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>今日销售额</span>
      </div>
    </template>
    <div class="text item">
      <div class="getday">{{ money }}元</div>
      </div>
  </el-card>
	</div>
		<div class="box">
<el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>当日订单量</span>
      </div>
    </template>
    <div class="text item">
       <div class="getday">{{ count }}笔</div>
    </div>
  </el-card>
	</div>
		<div class="box">
<el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>当月订单量</span>
      </div>
    </template>
    <div class="text item">
       <div class="getday">{{ counttwo }}笔</div>
    </div>
  </el-card>
	</div>
  		<div class="box">
<el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>当月销售额</span>
      </div>
    </template>
    <div class="text item">
       <div class="getday">{{ moneytwo }}元</div>
    </div>
  </el-card>
	</div>
	</div>
</template>

<script>
import { getday,getmonth } from "../api"
export default {
    data(){
      return{
        money:0,
        count:0,
        moneytwo:0,
        counttwo:0
      }
    },
    created(){
      getday().then(res=>{
        for(let item of res.data.data){
          this.count++
          this.money+=parseInt(item.money)
        }
       
      }),
      getmonth().then(res=>{
        for(let item of res.data.data){
          this.counttwo++
          this.moneytwo+=parseInt(item.money)
        }
      })
    }
    
}
</script>

<style scoped>
.box{
	width: 250px;
	height: 200px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
	border-radius: 15px;
}
.card-header span{
	font-size: 18px;
	font-weight: bolder;
}
.getday{
text-align: center;
font-size: 20px;
font-weight: 600;
}
</style>